package com.ruoyi.qcsystem.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.qcsystem.domain.entity.QualityConfirmation;
import com.ruoyi.qcsystem.domain.entity.QualityMoldConfirmation;
import com.ruoyi.qcsystem.mapper.QcDataMapper;
import com.ruoyi.qcsystem.mapper.QcMoldDataMapper;
import com.ruoyi.qcsystem.service.QcDataService;
import com.ruoyi.qcsystem.service.QcMoldDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QcMoldDataServiceImpl implements QcMoldDataService {

    @Autowired
    QcMoldDataMapper qcDataMapper;

    @Override
    public PageInfo<QualityMoldConfirmation> qualityConfirmationList(int lineId, int pageNub, int pageSize, String startTime, String endTime, String mpn, String lot) {
        PageHelper.startPage(pageNub,pageSize);
        List<QualityMoldConfirmation> qualityConfirmationList = qcDataMapper.qualityConfirmationList(lineId, startTime,endTime,mpn,lot);
        PageInfo<QualityMoldConfirmation> pageInfo=new PageInfo<>(qualityConfirmationList);
        return pageInfo;
    }

    @Override
    public List<com.ruoyi.ruoyictmanage.domain.entity.Line> lineList() {
        return qcDataMapper.lineList();
    }

    @Override
    public int addQualityConfirmation(QualityMoldConfirmation qualityConfirmation) {
        return qcDataMapper.addQualityConfirmation(qualityConfirmation);
    }

    @Override
    public int getMachineNumber(Integer lineId, long processId) {
        return qcDataMapper.getMachineNumber(lineId, processId);
    }

    @Override
    public int updateQualityConfirmation(QualityMoldConfirmation qualityConfirmation) {
        return qcDataMapper.updateQualityConfirmation(qualityConfirmation);
    }

    @Override
    public int confirmQualityConfirmation(Long qcId, String confirmer) {
        return qcDataMapper.confirmQualityConfirmation(qcId, confirmer);
    }

    @Override
    public int getQualityConfirmationCountByUserId(Long userId, Long qcId) {
        return qcDataMapper.getQualityConfirmationCountByUserId(userId, qcId);
    }

    @Override
    public int deleteQualityConfirmation(Long qcId) {
        return qcDataMapper.deleteQualityConfirmation(qcId);
    }

    @Override
    public List<QualityMoldConfirmation> qualityConfirmationList(Integer lineId, String startTime, String endTime, String mpn, String lot) {
        return  qcDataMapper.qualityConfirmationList(lineId, startTime,endTime,mpn,lot);
    }

    @Override
    public int getNewMoldDataIfNull(int lineId) {
        return qcDataMapper.getNewMoldDataIfNull(lineId);
    }
}
